from typing import Any

from django.shortcuts import render
from django.views import generic
from django.http import HttpResponse
from django.core.handlers.wsgi import WSGIRequest

from . import forms
from . import utils


class UserLogin(generic.View):
    """ Авторизация пользователя """

    def get(self, request: WSGIRequest) -> HttpResponse:
        form = forms.UserLoginForm()
        return render(request, 'registration/login.html', {'form': form})

    def post(self, request: WSGIRequest) -> HttpResponse:
        return utils.UsersUtils().process_user_authorization(request)
